<template>
  <!--<div>
    全国综合图
  </div>-->
  <div style="position: relative;height: 100%;">
    <!--图层选择-->
    <div style="padding:20px;">
      <span style="color:#606266;">可选图层：</span>
      <div style="position: relative;margin-left: 73px;margin-top: -25px;">
        <el-checkbox label="活断层避让分布图（100米）" @change="changeCheckBox9" />
        <el-checkbox label="活断层避让分布图（200米）" @change="changeCheckBox10" />
        <el-checkbox label="抗震加固工程分布图（新建工程）" @change="changeCheckBox1" />
        <el-checkbox label="抗震加固工程分布图（加固工程）" @change="changeCheckBox2" />
        <el-checkbox label="全国地震灾害风险区划图（抗震能力）" @change="changeCheckBox3" />
        <el-checkbox label="全国地震灾害风险区划图（人员伤亡）" @change="changeCheckBox4" />
        <el-checkbox label="全国地震灾害风险区划图（经济损失）" @change="changeCheckBox5" />
        <el-checkbox label="房屋加固优先级区划图" @change="changeCheckBox6" />
        <el-checkbox label="重点隐患分布图（房屋住宅）" @change="changeCheckBox7" />
        <el-checkbox label="重点隐患分布图（市政桥梁）" @change="changeCheckBox8" />
      </div>
    </div>
    <!--地图模块-->
    <Index v-if="showBool" :dataType="dataType" :sqlFilter="formSqlFilter" :form="form"></Index>
  </div>
</template>

<script setup name="nationalSynthesis">
//地图
import Index from '@/map/thematicMap/synthesis/nationalSynthesis/index.vue';
import {getSingle} from '@/api/thematicMap/divisionClass/earthquakeDisasterRisk.js';
import {getEngineeringDistribution} from "@/api/thematicMap/probeClass/seismicReinforcement";

//类型
const dataType = ref("");
const formSqlFilter = ref("");
const data = reactive({
  form:{
    // level2DataType:"singleRiskZonationConfirmKznl",
    level3DataType:"singleRiskZonationConfirmKznl",
    assessType:"seismicEd",
    range:{},//四个临界值设置;新疆、青海和西藏地区四个临界值设置
    show:false,
  },
})
const { form } = toRefs(data)
const showBool = ref(false);

const form1 = ref({});//抗震能力/极限状态四个临界值设置
const form2 = ref({});//死亡人数四个临界值设置
const form3 = ref({});//直接经济损失/区域内上年度 GDP四个临界值设置
//根据类型查询四个临界值设置
const getSingleData = (type) => {
  getSingle({ type }).then(res => {
    if (res.code == 200) {
      if (type == '1') {
        form1.value = res.data
      } else if (type == '2') {
        form2.value = res.data
      } else {
        form3.value = res.data
      }
    }
  })
}

//抗震加固工程分布图（新建工程）
function changeCheckBox1(bool){
  dataType.value = "新建工程";
  if(bool){
    formSqlFilter.value = "新建工程,全部";
  }else{
    formSqlFilter.value = "新建工程,移除";
  }
}

//抗震加固工程分布图（加固工程）
function changeCheckBox2(bool){
  dataType.value = "加固工程";
  if(bool){
    formSqlFilter.value = "加固工程,全部";
  }else{
    formSqlFilter.value = "加固工程,移除";
  }
}

//全国地震灾害风险区划图（抗震能力）
function changeCheckBox3(bool){
  dataType.value = "singleRiskZonationConfirm";
  if(bool){
    form.value = {
      // level2DataType:"singleRiskZonationConfirmKznl",
      level3DataType:"singleRiskZonationConfirmKznl",
      assessType:"seismicEd",
      range:form1.value,//四个临界值设置
      show:true,
    };
  }else{
    form.value = {
      // level2DataType:"singleRiskZonationConfirmKznl",
      level3DataType:"singleRiskZonationConfirmKznl",
      assessType:"seismicEd",
      range:form1.value,//四个临界值设置
      show:false,
    };
  }
}

//全国地震灾害风险区划图（人员伤亡）
function changeCheckBox4(bool){
  dataType.value = "singleRiskZonationConfirm";
  if(bool){
    form.value = {
      // level2DataType:"singleRiskZonationConfirmRk",
      level3DataType:"singleRiskZonationConfirmRk",
      assessType:"personCasualtiesEd",
      range:form2.value,//四个临界值设置;新疆、青海和西藏地区四个临界值设置
      show:true,
    };
  }else{
    form.value = {
      // level2DataType:"singleRiskZonationConfirmRk",
      level3DataType:"singleRiskZonationConfirmRk",
      assessType:"personCasualtiesEd",
      range:form2.value,//四个临界值设置;新疆、青海和西藏地区四个临界值设置
      show:false,
    };
  }
}

//全国地震灾害风险区划图（经济损失）
function changeCheckBox5(bool){
  dataType.value = "singleRiskZonationConfirm";
  if(bool){
    form.value = {
      // level2DataType:"singleRiskZonationConfirmJj",
      level3DataType:"singleRiskZonationConfirmJj",
      assessType:"economicLossesEd",
      range:form3.value,//四个临界值设置;新疆、青海和西藏地区四个临界值设置
      show:true,
    };
  }else{
    form.value = {
      // level2DataType:"singleRiskZonationConfirmJj",
      level3DataType:"singleRiskZonationConfirmJj",
      assessType:"economicLossesEd",
      range:form3.value,//四个临界值设置;新疆、青海和西藏地区四个临界值设置
      show:false,
    };
  }
}

//房屋加固优先级区划图
function changeCheckBox6(bool){
  dataType.value = "fwjgyxjd";
  if(bool){
    formSqlFilter.value = "fwjgyxjd,全部";
  }else{
    formSqlFilter.value = "fwjgyxjd,移除";
  }
}

//重点隐患分布图（房屋住宅）
function changeCheckBox7(bool){
  dataType.value = "zdyhfwm";
  if(bool){
    formSqlFilter.value = "zdyhfwm,全部";
  }else{
    formSqlFilter.value = "zdyhfwm,移除";
  }
}

//重点隐患分布图（市政桥梁）
function changeCheckBox8(bool){
  dataType.value = "zdyhszx";
  if(bool){
    formSqlFilter.value = "zdyhszx,全部";
  }else{
    formSqlFilter.value = "zdyhszx,移除";
  }
}

//活断层避让分布图（100米）
function changeCheckBox9(bool){
  dataType.value = "activeFaultAvoidance100";
  if(bool){
    formSqlFilter.value = "activeFaultAvoidance100,全部";
  }else{
    formSqlFilter.value = "activeFaultAvoidance100,移除";
  }
}

//活断层避让分布图（200米）
function changeCheckBox10(bool){
  dataType.value = "activeFaultAvoidance200";
  if(bool){
    formSqlFilter.value = "activeFaultAvoidance200,全部";
  }else{
    formSqlFilter.value = "activeFaultAvoidance200,移除";
  }
}

onMounted(() => {
  showBool.value = true;
  //根据类型查询四个临界值设置
  // getSingleData('1');
  // getSingleData('2');
  // getSingleData('3');
})
</script>

<style scoped lang="scss">

</style>


